Skip to main content

All Questions

1vote
1answer
276views

Speeding up naive backtracking Sudoku Solver in Haskell

After watching a recent computerphile video on building a very simple sudoku solver I tried to implement the same in Haskell. From this CR question I learned that it is probably a better idea to use ...
flawr's user avatar
3votes
1answer
134views

Monoidal tree interview in Haskell

I was working on the following interview question: Given an array of integers, return a new array such that each element at index i of the new array is the ...
new_to_haskell's user avatar
3votes
0answers
207views

Sudoku solver in Haskell using Reader+ST

While trying to understand monad transformers in Haskell I came up with a sudoku solver based on a combination of the ST and Reader monad. I am positively surprised with the performance, however ...
curious's user avatar
2votes
1answer
111views

HashCash Algorithm header generation in Haskell

A thought exercise on my part as I'm relatively new to Haskell. I wanted an interesting project to work on so I decided to implement the Hashcash Algorithm, which is most commonly used as the basis of ...
maple_shaft's user avatar
6votes
2answers
257views

Imperative Sieve of Eratosthenes using destructive updates in Haskell

I've implemented the prime sieve of Eratosthenes in Haskell using a mutable array of unboxed Bools instead of the usual pure and immutable datastructures. My main concern with this code is speed. For ...
user3493525's user avatar
5votes
2answers
148views

Function that produces \$a^nb^nc^n\$

I'm trying to write a function that produces an infinite list containing strings of the form \$a^nb^nc^n\$. My first idea was to do it using comprehensions. ...
Michael Chav's user avatar
1vote
2answers
300views

Brotli compression algorithm, translated from Python into Haskell

I have converted some code in Python into its Haskell equivalent. Python implementation: ...
GeneralBecos's user avatar
3votes
3answers
355views

Efficient Collatz sequence analysis

I'm new to Haskell, and I'm wondering why my programs are so slow compared to other languages. Haskell, 6 seconds (x64, -O2): ...
Alexey Lebedev's user avatar
3votes
1answer
209views

Space and time complexity of operation on lists

I'm new to programming and even more new to Haskell. Below is a little tid-bit I wrote that operates on a bunch of lists. I am wondering if someone would be kind enough to walk through the function <...
chibro2's user avatar
7votes
4answers
856views

Finding the sum of all the multiples of 3 or 5 below 1000, using list comprehension

I'm trying to compare my own implementation with another solution of Project Euler problem #1, which uses a list comprehension: ...
Rob's user avatar
  • 324
10votes
1answer
548views

Graph generator for undirected graphs

I am still pretty new to Haskell and am working on a graph generator for undirected unlabeled graphs containing loops and I have a bottleneck in the following functions. So far, I have not given any ...
user avatar

close